<?php

namespace App\Http\Presenters;

use Laracasts\Presenter\Presenter;

class ActivityPresenter extends Presenter
{
    /**
     * Present a link to the user gravatar
     */

    public function showtime()
    {
        if ($this->date_begin == $this->date_end)
            return date('Y年n月j日', $this->date_begin) . '（' . WEEK[date('w', $this->date_begin)] . '）';

        return date('n月j日', $this->date_begin) . '—' . date('n月j日', $this->date_end);

    }


    public function showDate()
    {
        
        return date('n/j D', $this->date_begin);

    }


    public function showtitle()
    {
        if ($this->status == 1)
            return '<span class="pink2"><b>' . $this->name . '</b></span>';

        return '<span class="smaller-90">' . $this->name . '</span>';

    }


    public function dropdown()
    {
        if ($this->status == 0) {
            return '<li class="act-start">
                  <a><span class="green"><i class="ace-icon fa fa-play bigger-120"></i>&nbsp;活动开始</span></a>
                </li>                
                <li class="act-end">
                  <a><span class="grey"><i class="ace-icon fa fa-stop bigger-120"></i>&nbsp;结束活动</span></a>
                </li><li class="divider"></li>';
        } elseif ($this->status == 1) {
            return '<li class="act-end">
                  <a><span class="grey"><i class="ace-icon fa fa-stop bigger-120"></i>&nbsp;结束活动</span></a>
                </li><li class="divider"></li>';
        }

    }

    public function activityStatus()
    {
        switch ($this->status) {
            case 1:
                return '<span class="green" ><i class="ace-icon fa fa-circle smaller-50"></i></span>';
                break;
            case 0:
                return '<span class="grey"><i class="ace-icon fa fa-circle smaller-50"></i></span>';
                break;
            case -1:
                return '<span class="red3"><i class="ace-icon fa fa-circle smaller-50"></i></span>';
                break;
        }
    }

    public function actStatus()
    {
        switch ($this->status) {
            case 1:
                return '<span class="green"><i class="ace-icon fa fa-play bigger-120"></i>&nbsp;进行中</span>';
                break;
            case 0:
                return '<span class="red"><i class="ace-icon fa fa-pause bigger-120"></i>&nbsp;未开始</span>';
                break;
            case -1:
                return '<span class="grey"><i class="ace-icon fa fa-stop bigger-120"></i>&nbsp;已结束</span>';
                break;
        }
    }

    public function actShow()
    {
        $show = '';
        if ($this->open == 1)
            $show = '<span class="red"><i class="ace-icon fa fa-tag bigger-120"></i></span>';
        if ($this->display == 1)
            $show .= '&nbsp;<span class="blue"><i class="ace-icon fa fa-cloud bigger-120"></i></span>';

        return $show;
    }


}
